import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from '../user/entities/user.entity';
import { SmsCode } from '../sms/entities/sms-code.entity';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { JwtStrategy } from '../../strategies/jwt.strategy';
import { SmsModule } from '../sms/sms.module';
import { OperationLoggerService } from '../../services/operation-logger.service';
import { JWT_SECRET } from '../../config/jwt.config';
import { TencentImService } from '../message/tencent-im.service';

@Module({
  imports: [
    PassportModule.register({ defaultStrategy: 'jwt' }),
    TypeOrmModule.forFeature([User, SmsCode]),
    JwtModule.register({
      secret: JWT_SECRET,
      signOptions: { expiresIn: '7d' },
    }),
    SmsModule,
  ],
  controllers: [AuthController],
  providers: [
    AuthService,
    JwtStrategy,
    OperationLoggerService,
    TencentImService, // 添加 TencentImService
  ],
  exports: [AuthService],
})
export class AuthModule {}

